package in.muton.edushare.poll.answers;

import in.muton.edushare.pages.EduShareBasePage;
import in.muton.edushare.poll.answers.individual.FreeFormSingleAns;

import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.PropertyModel;

import com.edushare.common.dao.UserPollDAO;
import com.edushare.common.vo.PollQuestions;

public class ShortTextAnswer extends AnswerBase {
	private static final long serialVersionUID = 1810418149984708908L;

	public ShortTextAnswer(String id, IModel<PollQuestions> model,
			EduShareBasePage page) {
		super(id, model, page);
		add(new Label("totalAnswers", new PropertyModel<Integer>(this,
		"totalAnswers")));
		add(new FreeFormSingleAns("answerList", model));
	}
	
	public Integer getTotalAnswers() {
		return new UserPollDAO(getORMInterface())
				.getFreeformAnswers(getQuestionModel().getObject()).size();
	}
	
}
